<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class OxPeople
{
    public $idpeople;
    public $name;

    function __construct()
    {
    }
    
    private static function from_data($data)
    {
        $new_tag = new OxPeople();
        $new_tag->idpeople = $data->idpeople;
        $new_tag->name = $data->name;
        return $new_tag;
    }
    public static function from_id($id)
    {
        $CI =& get_instance();
        
		$query = $CI->db->select('*')
                              ->from('people')
                              ->where('idpeople',$id)
                              ->get()->result();
        
        return OxPeople::from_data($query[0]);
    }
    public static function from_ids($ids)
    {
        $CI =& get_instance();
        
		$query = $CI->db->select('*')
                              ->from('people')
                              ->where('idpeople in ('.$ids.')')
                              ->get()->result();
        
        $res = array();
        foreach($query as $q)
        {
            $res[] = OxPeople::from_data($q);
        }
        
        return $res;
    }

    
}